﻿using M6R小圆柱注液机.Data;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace M6R小圆柱注液机.Pages
{
    public partial class 调试 : Form
    {
        public 调试()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Stopwatch sp = new Stopwatch();
            sp.Start();
            textBox1.Text = GlobalValues.newScanner_1.SendBackMessageInstant(GlobalValues.ScannerTrigherCommand.StartTrigger, 1000);//扫条码
            sp.Stop();
            textBox2.Text = sp.Elapsed.TotalMilliseconds.ToString();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            GlobalValues.newScanner_2.SendBackMessageInstant(GlobalValues.ScannerTrigherCommand.scanBufferCaler, 1000);//扫条码   
            Stopwatch sp = new Stopwatch();
            sp.Start();
            string xx = GlobalValues.newScanner_2.SendBackMessageInstant(GlobalValues.ScannerTrigherCommand.StartTrigger, 5000);//扫条码   
            sp.Stop();
            if (xx == null)
            {
                GlobalValues.newScanner_2.SendBackMessageInstant(GlobalValues.ScannerTrigherCommand.StopTrigger, 1000);//扫条码   
                textBox1.Text = "Error";
            }
            else
            {
                textBox1.Text = xx;
            }

            textBox2.Text = sp.Elapsed.TotalMilliseconds.ToString();
        }

        private void button3_Click(object sender, EventArgs e)
        {
            GlobalValues.newScanner_2.SendBackMessageInstant(GlobalValues.ScannerTrigherCommand.scanBufferCaler, 1000);//扫条码   
            Stopwatch sp = new Stopwatch();
            sp.Start();
            string xx = GlobalValues.newScanner_3.SendBackMessageInstant(GlobalValues.ScannerTrigherCommand.StartTrigger, 5000);//扫条码     
            sp.Stop();
            if (xx == null)
            {
                GlobalValues.newScanner_3.SendBackMessageInstant(GlobalValues.ScannerTrigherCommand.StopTrigger, 1000);//扫条码   
                textBox1.Text = "Error";
            }
            else
            {
                textBox1.Text = xx;
            }

            textBox2.Text = sp.Elapsed.TotalMilliseconds.ToString();
        }


    }
}
